package com.googlecode.gwt4gae.server;

import javax.servlet.http.HttpServlet;

import com.google.inject.servlet.ServletModule;

public class Gwt4gaeServletModule extends ServletModule {
	private String url;
	private String service;	
	
	public Gwt4gaeServletModule(String url, String service) {
		super();
		this.url = url;
		this.service = service;
	}

	@SuppressWarnings("unchecked")
	@Override
	protected void configureServlets() {
		try {
			Class<?> serviceClass = Class.forName(service);
			serve(this.url).with((Class<? extends HttpServlet>) serviceClass);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
}
